{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "4ab188ff",
   "metadata": {},
   "source": [
    "1【简答题】练习2-04:\n",
    "\n",
    "有一百个瓶子，分别编号为1一100。现在有人拿枪从第一个开始射击，每枪击破一个跳过-。接着在剩下的瓶子里面再次击破第一个，间隔一个再击破一个，请问最后\n",
    "\n",
    "剩下完整的瓶子是这一百个瓶子里的第几个?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "131fa90d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[64]\n"
     ]
    }
   ],
   "source": [
    "bottles = list(range(1, 100))\n",
    "while len(bottles) > 1:\n",
    "    bottles = bottles[1::2]\n",
    "print(bottles)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "526330c1",
   "metadata": {},
   "source": [
    "【简答题】练习3-01：\n",
    "\n",
    "回文（palindrome）是正读或者反读都相同的单词或短语，忽略空格和字母大小写。例如，下面的示例都是回文：warts n straw、radar、xyzczyx\n",
    "\n",
    "编写一个程序，判断输入的字符串是否是回文。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "49be02d3",
   "metadata": {},
   "outputs": [],
   "source": [
    "def is_palindrome(s):\n",
    "    return s == s[::-1]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
